import 'package:flutter/material.dart';
import 'package:flutter_bounceable/flutter_bounceable.dart';

class ClickableContainer extends StatelessWidget {
  const ClickableContainer(
      {super.key,
      required this.child,
      this.color,
      this.width,
      this.height,
      this.gradient,
      this.border,
      this.padding,
      this.margin,
      this.borderRadius,
      this.onTap,
      this.alignment,
      this.shape,
      this.boxShadow});

  final Widget child;
  final Color? color;
  final Gradient? gradient;
  final BorderRadiusGeometry? borderRadius;
  final BoxShadow? boxShadow;
  final EdgeInsetsGeometry? margin;
  final VoidCallback? onTap;
  final double? width;
  final double? height;
  final EdgeInsetsGeometry? padding;
  final BoxBorder? border;
  final Alignment? alignment;
  final BoxShape? shape;

  @override
  Widget build(BuildContext context) {
    return Bounceable(
      onTap: onTap,
      child: Container(
        width: width,
        height: height,
        margin: margin,
        decoration: BoxDecoration(
          color: color,
          gradient: gradient,
          borderRadius: borderRadius,
          shape: shape ?? BoxShape.rectangle,
          border: border,
          boxShadow: boxShadow == null ? null : [boxShadow!],
        ),
        child: Material(
          color: Colors.transparent,
          child: Container(
            padding: padding,
            alignment: alignment,
            child: child,
            decoration: BoxDecoration(
              borderRadius: borderRadius?.resolve(Directionality.of(context)),
            ),
          ),
        ),
      ),
    );
  }
}
